﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenGL;

namespace NavLine.Aircraft
{
	public class TestForm : GLForm
	{
		public TestForm()
		{

		}
		List<V3D> Trace1 = new List<V3D>();
		List<V3D> Trace2 = new List<V3D>();
		protected override void InitGL()
		{
			AC X = new AC(null, V3G.Null, 0, 0);
			X.position = new V3G(0, 0);
			X.heading = 45;
			X.speed = 200;
			for (int i = 0; i < 10000; i++)
			{
				for (int j = 0; j < 10; j++)
				{
					X.Process(1);
					X.heading = 45;
				}
				Trace1.Add(X.position);
			}
		}
		protected override void Process(double dt, double tt)
		{
		}
		protected override bool DrawGLScene()
		{
			GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
			MakePerspective(60, 0.1f, 10000000);
			V3D C = new V3G(0, 89.99, 0);
			GL.gluLook3D(C * 1.01, V3D.Black, V3D.Green);
			//GL.gluLookAt(0, 0, V3G.EarthRadius+10000000, 0, 0, 0, 0, 1, 0);
			//GL.Set3GView(new V3G(3, 0), 60000, -20);
			GL.glBegin(GL.GL_LINES);
			for (int i = 0; i < 50; i++)
				for (int j = 0; j < 50; j++)
				{
					GL.glV3D(new V3G(i, j));
					GL.glV3D(new V3G(i, j + 1));
					GL.glV3D(new V3G(i, j));
					GL.glV3D(new V3G(i + 1, j));
				}
			GL.glEnd();
			GL.glCol3D(V3D.Red);
			GL.glBegin(GL.GL_LINE_STRIP);
			foreach(V3D V in Trace1)GL.glV3D(V);
			GL.glEnd();
			GL.glCol3D(V3D.White);
			return true;
		}
	}
}